﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using Space.Library;

namespace Space.Model
{
    public class ShipModel
    {
        public ShipModel(string name, int shieldMax, int armorHpMax, int internalHpMax, Race owner, OwnerType ownerType, ShipType shipType)
        {
            ShipType = shipType;

            InternalHpMax = internalHpMax;
            Owner = owner;
            OwnerType = ownerType;
            ArmorHpMax = armorHpMax;
            ShieldMax = shieldMax;
            Weapons = new List<ShipWeapon>();
            Name = name;

            Init();
        }

        // Stats
        public string Name { get; set; }

        public OwnerType OwnerType { get; set; }
        public Race Owner { get; set; }

        public int InternalHpMax { get; private set; }
        public int InternalHp { get; set; }

        public int ArmorHpMax { get; private set; }
        public int ArmorHp { get; set; }

        public int ShieldMax { get; private set; }
        public int ShieldTop { get; set; }
        public int ShieldBottom { get; set; }
        public int ShieldLeft { get; set; }
        public int ShieldRight { get; set; }

        public int ShieldTopStr { get { return 100 * ShieldTop / ShieldMax; } }
        public int ShieldBottomStr { get { return 100 * ShieldBottom / ShieldMax; } }
        public int ShieldLeftStr { get { return 100 * ShieldLeft / ShieldMax; } }
        public int ShieldRightStr { get { return 100 * ShieldRight / ShieldMax; } }

        public ShipType ShipType { get; set; }

        public List<ShipWeapon> Weapons { get; set; }

        public void Init()
        {
            ShieldTop = ShieldMax;
            ShieldBottom = ShieldMax;
            ShieldLeft = ShieldMax;
            ShieldRight = ShieldMax;

            InternalHp = InternalHpMax;
            ArmorHp = ArmorHpMax;
        }

        public void AddWeapon(ShipWeapon weapon)
        {
            Weapons.Add(weapon);
        }
    }
}
